package com.example.service.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 租户实体类
 * @author zdyuMath
 * @date 2023/9/17
 */

@Schema(description = "租户实体类")
@Data
@Entity
@Table(name = "system_tenant")
public class SystemTenant{


    /**
     * 主键
     */
    @Schema(description = "主键", example = "1")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 租户名称
     */
    @Schema(description = "租户名称")
    @Column(name = "name", nullable = false, length = 100)
    private String name;

    /**
     * 租户别称
     */
    @Schema(description = "租户别称")
    @Column(name = "nickname", nullable = false, length = 100)
    private String nickname;

    /**
     * 租户邮箱
     */
    @Schema(description = "租户邮箱")
    @Column(name = "email", length = 100)
    private String email;

    /**
     * 租户电话
     */
    @Schema(description = "租户电话")
    @Column(name = "phone")
    private Long phone;

    /**
     * 租户地址
     */
    @Schema(description = "租户地址")
    @Column(name = "address")
    private String address;

    /**
     * 授权开始时间
     */
    @Schema(description = "授权开始时间")
    @Column(name = "permission_start")
    private LocalDateTime permissionStart;

    /**
     * 授权结束时间
     */
    @Schema(description = "授权结束时间")
    @Column(name = "permission_end")
    private LocalDateTime permissionEnd;

    /**
     * 授权用户数
     */
    @Schema(description = "授权用户数")
    @Column(name = "permission_user_count", nullable = false)
    private Integer permissionUserCount;

    /**
     * 已有用户数
     */
    @Schema(description = "已有用户数")
    @Column(name = "ready_user_count", nullable = false)
    private Integer readyUserCount;

    /**
     * 状态 1-正常 0-停用
     */
    @Schema(description = "状态 1-正常 0-停用")
    @Column(name = "status", nullable = false)
    private Short status;

    /**
     * 逻辑删除字段 0-未删除 1-已删除
     */
    @Schema(description = "逻辑删除字段 0-未删除 1-已删除")
    @Column
    private Integer isDeleted;

    /**
     * 创建人
     */
    @Schema(description = "创建人")
    @Column
    private Long createdBy;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @Column
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdAt;

    /**
     * 修改人
     */
    @Schema(description = "修改人")
    @Column
    private Long updatedBy;

    /**
     * 修改时间
     */
    @Schema(description = "修改时间")
    @Column
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updatedAt;

}